<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c"uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
		<link title=style href="style.css" type=text/css rel=StyleSheet>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<script type="text/javascript" src="/Message/js/jquery.js"></script>
		<script type="text/javascript">
		$(document).ready(function(){
			$("#searchSubmit").on("click",function(){
				if(!$("#search").val()){
					$("#span").html("<font color='red'>아이디를 입력하세요</font>");
					document.searchId.focus();
					return false;
				}else{
					document.form.submit();
				}
			});
		});
		</script>
</head>
<body>
		<h2>전체 답글목록</h2>
	<br>
	<table border="1"cellspacing="0" width="700">
		<tr>
			<th id="number" style="width:80px;">받는사람</th>
			<th id="title" style="width:400px;">제목</th>
			<th id="writer" style="width:100px;">작성자</th>
			<th id="date" style="width:120px;">작성일</th>
		</tr>
		<c:forEach items="${requestScope.lto.list }"var="list">
			<tr>
				<td headers="number" align="center">${list.messageReceiver }</td>
				<!-- 답글달때 앞에 ▶ 띄우기 위해서  -->
				<td headers="title">
				<c:if test="${list.relevel!=0 }">&nbsp&nbsp&nbsp&nbsp(▶RE)</c:if>
				<a href="message.do?method=linkController&no=${list.messageNo }&page=${requestScope.lto.pto.currentPage}&id=replySearch">${list.messageTitle }</a></td>
				<td headers="writer" align="center">${list.messageWriter }</td>
				<td headers="date" align="center">${list.messageWritedate }</td>
			</tr>
		</c:forEach>
	</table>
	<div align="center" style="width:700px;">
	
		<c:choose>
			<c:when test="${requestScope.lto.pto.previousPageGroup}">
				<a href="message.do?method=searchByIdController&id=replyMessage&page=${requestScope.lto.pto.startPageOfPageGroup-1 }">◀</a>
			</c:when>
			<c:otherwise>
				◀
			</c:otherwise>
		</c:choose>
		<c:forEach begin="${requestScope.lto.pto.startPageOfPageGroup }"end="${requestScope.lto.pto.endPageOfPageGroup }"var="i">
			<c:choose>
			<c:when test="${requestScope.lto.pto.currentPage==i }">
				<font color="red">${i }</font>
			</c:when>
			<c:otherwise>
			<a href="message.do?method=searchByIdController&id=replyMessage&searchId=${param.searchId }&page=${i}">${i }</a>
			</c:otherwise>
			</c:choose>
		</c:forEach>
		<c:choose>
			<c:when test="${requestScope.lto.pto.nextPageGroup }">
			<a href="message.do?method=searchByIdController&id=replyMessage&page=${requestScope.lto.pto.endPageOfPageGroup+1 }">▶</a>
			</c:when>
			<c:otherwise>
				▶
			</c:otherwise>
		</c:choose>
	</div>
	<a href="message.do?method=ReplyListController">전체 답글목록</a>
	<a href="message.do?method=listController">전체 문의목록</a>
	
	<form action="message.do?method=searchByIdController&page=1&id=replyMessage" method="post" name="form">
	<br><br><input type="text" name="searchId" id="search" style="border:solid #1DDB16; height:20px" value="ID 검색" onfocus="this.value=''; return true"><input type="button" id="searchSubmit" value="검색"> <span id="span"></span>
	</form>
	
</body>
</html>